<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>留言板1.0</title>
	<link rel="stylesheet" href="./template/css/bootstrap.min.css">
	<script src="./template/js/bootstrap.min.js"></script>
</head>
<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">留言板</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <form class="navbar-form navbar-right">
            <div class="form-group">
              <input type="text" placeholder="Email" class="form-control">
            </div>
            <div class="form-group">
              <input type="password" placeholder="Password" class="form-control">
            </div>
            <button type="submit" class="btn btn-success">Sign in</button>
          </form>
        </div><!--/.navbar-collapse -->
      </div>
    </nav>
   <div class="container" style="margin-top: 80px;">
      <!-- Example row of columns -->
      <div class="row">
	      	<div class="col-sm-12">
	        <form class="form-inline" action="./upload.php" method="post" enctype="multipart/form-data" style="text-align: center;position: relative;">
			  <input type="file" class="form-control"  name="file" style="width: 82px;position: absolute;top: 0px;left: 50%;margin-left: -70px;opacity: 0" placeholder="Jane Doe" multiple="multiple" >
			  <button type="button" class="btn btn-success">选择文件</button>
			  <button type="submit" class="btn btn-success">发布</button>
			</form>
			</div>
		</div>
      <div class="row"  style="margin-top: 50px;">
      	<table class="table table-hover">
	      <thead>
	        <tr>
	          <th>ico</th>
	          <th>文件名</th>
	          <th>大小</th>
	          <th>时间</th>
	          <th width="150">操作</th>
	        </tr>
	      </thead>
	      <tbody>
	      	<?php foreach ($files as $key => $file): ?>
	        <tr>
	          <th scope="row"><?php echo getTypeIco($file); ?></th>
	          <td><?php echo basename($file); ?></td>
	          <td><?php echo Fsize(filesize($file)); ?></td>
	          <td><?php echo Ftime(filemtime($file)); ?></td>
	          <td>
	          	<a class="glyphicon glyphicon-download-alt btn btn-success btn-xs" href="./download.php?url=<?php echo $file; ?>"></a>
	          	<a class="glyphicon glyphicon-trash btn btn-danger btn-xs" href="./del.php?url=<?php echo $file; ?>"></a>
	          </td>
	        </tr>
	        <?php endforeach ?>
	      </tbody>
	    </table>
	    <nav aria-label="...">
        <ul class="pagination">
          <!-- 判断上一页 -->
          <?php if($p!=1){ ?>
            <li class="
          "><a href="./index.php?p=<?php echo $p-1; ?>" aria-label="Previous"><span aria-hidden="true">上一页</span></a></li>
          <?php } ?>
          <!-- 循环所有页码 -->
          <?php for ($i=1; $i <=$total ; $i++) { ?>
            <li <?php if($p==$i){ echo "class='active'";} ?>><a href="./index.php?p=<?php echo $i; ?>"><?php echo $i; ?></a></li>
          <?php } ?>
          <!-- 判断下一页 -->
          <?php if($p<$total) { ?>
          <li><a href="./index.php?p=<?php echo $p+1; ?>" aria-label="Next"><span aria-hidden="true">下一页</span></a></li>
          <?php } ?>

       </ul>
     </nav>
      </div>
	</div>
</body>
</html>